package de.bloxel.util;

import com.jme3.bounding.BoundingBox;
import com.jme3.math.Vector3f;

/**
 * @author andreas
 * @since 0.1.0
 */
public final class VectorUtils {

  /**
   * @param box1
   * @param box2
   * @return <code>true</code> if box2 is complete inside box1 else <code>false</code>
   */
  public static final boolean isInside(final BoundingBox box1, final BoundingBox box2) {
    final Vector3f minBox1 = new Vector3f();
    final Vector3f minBox2 = new Vector3f();
    final Vector3f maxBox1 = new Vector3f();
    final Vector3f maxBox2 = new Vector3f();
    box1.getMin(minBox1);
    box2.getMin(minBox2);
    box1.getMax(maxBox1);
    box2.getMax(maxBox2);
    return (minBox1.x <= minBox2.x) && (minBox1.y <= minBox2.y) && (minBox1.z <= minBox2.z) // min
        && (maxBox1.x >= maxBox2.x) && (maxBox1.y >= maxBox2.y) && (maxBox1.z >= minBox2.z); // max
  }

  /**
   * @param scalar
   * @return
   */
  public static final Vector3f V(final float scalar) {
    return Vector3f.UNIT_XYZ.mult(scalar);
  }
}
